@ Practice04-Subroutine_asciiStr2Int 

@ Subroutine asciiStr2Int
@	ldr r12, addr_str	@ r3 = 0x9000
@	eor r0, r0, r0		@ r0 = 0
@	ldrb r11, [r12]		@ the 1st char
@LOOP:
@	cmp r11, #0		@ is it '\0'?
@	beq DONE
@	mov r10, #10		@ r10 = 10
@	mul r1, r0, r10
@	sub r11, r11, #0x30	@ '0' in ascii
@	add r0, r1, r11
@	add r12, r12, #1
@	ldrb r11, [r12]		@ get the next
@	b LOOP
@DONE:
@	mov r1, r0
@	ldr r0, addr_screen
@	bl printInt
@	b halt

asciiStr2Int:
	mov r12, r0
	eor r0, r0, r0
	ldr r11, [r12]
LOOP:
	cmp r11, #0
	beq DONE
	mov r10, #10
	mul r1, r0, r10
	sub r11, r11, #0x30
	add r0, r1, r11
	add r12, r12, #1
	ldrb r11, [r12]
	b LOOP
DONE:
	mov pc, lr